import { request } from '@/utils/request'

const API_BASE = 'http://localhost:8004/api/v1'

export default {
  // 用户相关
  login: (data) => request(`${API_BASE}/user/login`, 'POST', data),
  register: (data) => request(`${API_BASE}/user/register`, 'POST', data),
  getUserInfo: () => request(`${API_BASE}/user/info`, 'GET'),
  updateUserInfo: (data) => request(`${API_BASE}/user/info`, 'PUT', data),
  
  // 车辆相关
  saveCar: (data) => request(`${API_BASE}/car/save`, 'POST', data),
  deleteCar: (id) => request(`${API_BASE}/car/${id}`, 'DELETE'),
  getIndexInfo: () => request(`${API_BASE}/car/index`, 'GET'),
  getCarInfo: () => request(`${API_BASE}/car/info`, 'GET'),
  
  // 油耗记录
  saveRecord: (data) => request(`${API_BASE}/record/save`, 'POST', data),
  getRecord: (params) => request(`${API_BASE}/record/detail`, 'GET', null, params),
  getRecords: (params) => request(`${API_BASE}/record/list`, 'GET', null, params),
  getStatistics: (params) => request(`${API_BASE}/record/statistics`, 'GET', null, params),
  getRanking: () => request(`${API_BASE}/record/ranking`, 'GET'),
  
  // 费用统计
  getCostStatistics: (params) => request(`${API_BASE}/cost`, 'GET', null, params)
}